Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error for incorrect PublishSelfContained #46171

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sbomer
Copy link
Member

@sbomer sbomer commented Jan 21, 2025

For the following project (note it sets PublishSelfContained):

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <PublishSelfContained>true</PublishSelfContained>
  </PropertyGroup>

</Project>

This command doesn't produce a self-contained publish output:

> dotnet build /t:Publish
Restore complete (0.4s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  selfc succeeded (0.3s) → bin/Debug/net10.0/publish/

Build succeeded in 1.1s
> ls bin/Debug/net10.0/
publish  selfc  selfc.deps.json  selfc.dll  selfc.pdb  selfc.runtimeconfig.json
> ls bin/Debug/net10.0/publish/
selfc  selfc.deps.json  selfc.dll  selfc.pdb  selfc.runtimeconfig.json

This adds an error message for this unsupported scenario.

Related: #32272 (discusses the PublishSelfContained behavior with /t:Publish)
Related: dotnet/runtime#95496
Related: #46070

@sbomer sbomer requested review from AntonLapounov and a team as code owners January 21, 2025 19:10
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Request triage from a team member labels Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant